<template>
  <div class="product-list">
    <div
      v-for="(item, idx) in products"
      :key="item.title"
      :class="['product-row', idx % 2 === 0 ? 'row-normal' : 'row-reverse']"
    >
      <div class="product-img">
        <img :src="item.img" :alt="item.title" />
      </div>
      <div class="product-info">
        <h4 class="slh">
          <i class="iconfont icon-title2"></i>
          {{ item.title }}
        </h4>
        <p>{{ item.desc }}</p>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import home1 from '@/assets/images/products/home1.jpg'
import home2 from '@/assets/images/products/home2.jpg'
import home3 from '@/assets/images/products/home3.jpg'
import home4 from '@/assets/images/products/home4.jpg'
import home5 from '@/assets/images/products/home5.jpg'
import home6 from '@/assets/images/products/home6.jpg'
const products = [
  {
    title: '水太极宫温筋治疗液',
    img: home1,
    desc: '酸痛不过夜——预防亚健康！ 提高身体免疫力！关爱百姓健康！'
  },
  {
    title: '玻尿酸平衡精华液',
    img: home2,
    desc: '女人魅力专属，值得你拥有'
  },
  {
    title: '玻尿酸平衡防护乳',
    img: home3,
    desc: ''
  },
  {
    title: '玻尿酸平衡洁颜乳',
    img: home4,
    desc: '做女神就选爱之浓丝品牌，质优价廉更放心'
  },
  {
    title: '玻尿酸平衡调理霜',
    img: home5,
    desc: '女神肌肤如雪的秘密在这里，详情点击产品图片查看'
  },
  {
    title: '玻尿酸平衡祛角质素',
    img: home6,
    desc: '厂家直供，保证质优价廉，欢迎订购'
  }
]
</script>

<style lang="scss" scoped>
.product-list {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.product-row {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  padding: 32px;
  min-height: 120px;
  justify-content: center;
  border: 2px solid #e8dbdf;
}

.row-normal {
  flex-direction: row;
}

.row-reverse {
  flex-direction: row-reverse;
}

.product-img {
  flex: 0 0 260px;
  display: flex;
  justify-content: center;
  align-items: center;
  img {
    width: 213px;
    height: 160px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #eee;
    background: #fafafa;
  }
}

.product-info {
  flex: 1;
  padding: 0 40px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  h4 {
    font-size: 20px;
    font-weight: bold;
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    .iconfont {
      margin-right: 8px;
      font-size: 22px;
      color: #ff6b9d;
    }
  }
  p {
    font-size: 15px;
    color: #999;
    margin: 0;
  }
}
</style>